<?php
namespace app\mini\controller\admin;

use suframe\thinkAdmin\controller\BaseController;
use suframe\thinkAdmin\traits\CURDController;
use suframe\thinkAdmin\ui\UITable;
use app\mini\model\MiniAdvPos as MiniAdvPosModel;

/**
* 广告位置管理
*/
class MiniAdvPos extends BaseController
{
    use CURDController;
    protected $urlPre = '/mini/admin/miniAdvPos/';

    private function getManageModel()
    {
        return MiniAdvPosModel::class;
    }

    private function ajaxSearch()
    {
        $rs = $this->parseSearchWhere($this->getManageModel());
        return json_return($rs);
    }

    /**
     * @param \suframe\form\Form $form
     * @throws \FormBuilder\Exception\FormBuilderException
     * @throws \ReflectionException
     */
    private function getFormSetting($form)
    {
        $form->setRuleByClass(\app\mini\ui\form\MiniAdvPosForm::class);
    }

    /**
     * @param UITable $table
     */
    private function getTableSetting($table)
    {
        $table->createByClass(\app\mini\ui\table\MiniAdvPosTable::class);
        $table->setButtons('add', ['title' => '增加', 'url' => $this->urlABuild('update')]);
        $table->setEditOps($this->urlA('update'), ['id']);
        $table->setDeleteOps($this->urlA('delete'), ['id']);
    }
}